Skip to content

refactor(storage): add SQLite context offload foundation - #4078

Draft
likun666661 wants to merge 1 commit into
mainfrom
refactor/context-offload-sqlite-foundation
Draft

refactor(storage): add SQLite context offload foundation#4078
likun666661 wants to merge 1 commit into
mainfrom
refactor/context-offload-sqlite-foundation

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

  • Define the durable Session context reference, typed owner identities, whole-object byte caps, quota inputs, and async context-offload Store contract.
  • Add a dedicated versioned SQLite authority with WAL, FULL synchronous durability, foreign keys, incremental auto-vacuum, content-addressed BLOBs, typed Session references, and transactionally maintained usage counters.
  • Implement atomic and idempotent put, Session-authorized whole-object read with SHA-256 verification, reference release, logical/physical quota enforcement, and fail-closed schema validation.

This is the storage-only first slice of #4071. It is intentionally not wired to Read image, Tool Result archives, StorageRef, Session copy/retirement, GC, or legacy migration yet, so it does not change production behavior.

Refs #4071

Verification

  • npm --workspace @maka/core run build
  • npm --workspace @maka/storage run build
  • NODE_NO_WARNINGS=1 node --test packages/storage/dist/__tests__/sqlite-context-offload-store.test.js — 11/11 pass
  • NODE_NO_WARNINGS=1 node --test --test-reporter=dot "packages/storage/dist/**/*.test.js" — full storage suite passes
  • npx biome lint on all changed TypeScript files
  • npm run check:asf-headers

Node 22 emits an experimental node:sqlite warning. Without NODE_NO_WARNINGS=1, one existing child-process fixture treats that warning as stderr failure; the fixture passes 5/5 with the warning disabled.

Follow-up slices

  • Add the authenticated Storage Root facade and freeze measured Session/workspace product quotas.
  • Add bounded copy, Session retirement, GC, checkpoint, vacuum, and backup operations.
  • Route Read image snapshots and Tool Result archives through typed facades.
  • Add post-Ready legacy migration and retire replay use of ArtifactStore.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex contributed repository inspection, interface/schema design, implementation, tests, and PR text. The commit includes the required Generated-by trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant